
 <template>
 	<el-dialog title="" visible :show-close="false" :modal-append-to-body="false" class="wrap" size="tiny">
 		<i class="el-icon-close close" @click="cancel" style="color: white;z-index:10;"></i>
		 <div class="bt">修改</div>
 		<el-form label-width="100px" class="form">
 			<el-form-item label="中文名">
 				<el-input v-model="form.zwm"  class="select-block"></el-input>
 			</el-form-item>
 			<el-form-item label="英文名">
 				<el-input v-model="form.ywm"  class="select-block"></el-input>
 			</el-form-item>
 			<el-form-item label="性别">
 				<!-- <el-input v-model="form.type" type="textarea" :rows="1" class="select-block"></el-input> -->
                   <el-select v-model="form.xb"   class="select-block" >
  					  <el-option label="男" value="男"></el-option>
  					<el-option label="女" value="女" ></el-option>
  			      </el-select>
 			</el-form-item>
 			<el-form-item label="电话">
 				<el-input v-model="form.dh" class="select-block"></el-input>
 			</el-form-item>
 			<!--<el-form-item label="密码">
 				<el-input v-model="form.mm"  class="select-block"></el-input>
 			</el-form-item> -->



 			<!--<el-form-item label="老师ID">
 				<el-input v-model="form.lsid"  class="select-block"></el-input>
 			</el-form-item>
 			<el-form-item label="班级ID">
 				<el-input v-model="form.bjid"  class="select-block"></el-input>
 			</el-form-item> -->
 			<!--<el-form-item label="是否同意">
 				<el-input v-model="form.isty"  class="select-block"></el-input>
 			</el-form-item>
 			<el-form-item label="是否支付">
 				<el-input v-model="form.iszf"  class="select-block"></el-input>
 			</el-form-item>
 			<el-form-item label="是否升级">
 				<el-input v-model="form.issj"  class="select-block"></el-input>
 			</el-form-item> -->
 			<el-form-item label="是否启用">
 				<!-- <el-input v-model="form.type" type="textarea" :rows="1" class="select-block"></el-input> -->
                   <el-select v-model="form.isqy"   class="select-block" >
  					  <el-option label="启用" value="Y"></el-option>
  					<el-option label="禁用" value="N" ></el-option>
  			      </el-select>
 			</el-form-item>
 			<!--<el-form-item label="类型(sq:申请/zr:转入)">
 				<el-input v-model="form.lx"  class="select-block"></el-input>
 			</el-form-item> -->
 			<el-form-item label="出生日期">
 				<el-input v-model="form.csrq"  class="select-block"></el-input>
 			</el-form-item>
 			<el-form-item label="招生来源">
 				<el-input v-model="form.zsly"  class="select-block"></el-input>
 			</el-form-item>
 			<el-form-item label="父母手机号">
 				<el-input v-model="form.fmdh"  class="select-block"></el-input>
 			</el-form-item>
 			<el-form-item label="微信号">
 				<el-input v-model="form.wx"  class="select-block"></el-input>
 			</el-form-item>
 			<el-form-item label="家庭地址">
 				<el-input v-model="form.jtdz"  class="select-block"></el-input>
 			</el-form-item>
 			<el-form-item label="公立学校">
 				<el-input v-model="form.glxx" class="select-block"></el-input>
 			</el-form-item>
 			<el-form-item label="年级班级">
 				<el-input v-model="form.njbj"  class="select-block"></el-input>
 			</el-form-item>
 			<!--<el-form-item label="班级">
 				<el-input v-model="form.bj"  class="select-block"></el-input>
 			</el-form-item> -->
 			<el-form-item label="学号">
 				<el-input v-model="form.xh" class="select-block"></el-input>
 			</el-form-item>
 			<el-form-item label="账号余额">
 				<el-input v-model="form.yuer"  class="select-block"></el-input>
 			</el-form-item>
 		</el-form>
 		<el-button type="info" class="submit" @click="submit">修改</el-button>
 	</el-dialog>
 </template>
 <script type="text/javascript">
 	import qs from 'qs'
 	export default {
 		props: ['params'],
 		data() {
 			return {
 				form: {
					 dh :'',
					 xb :'',
					 zwm :'',
					 ywm :'',
					 isqy :'',
					 csrq :'',
					 zsly :'',
					 fmdh :'',
					 wx :'',
					 jtdz :'',
					 glxx :'',
					 njbj :'',
					 xh :'',
 					id:''
 				}
 			}
 		},
 		created() {
  		 this.form.id = this.params.row.id;
          this.loadinfo();
 		},
 		methods: {
 			loadinfo(){
 				 var logininfo = JSON.parse(localStorage.logininfo) ;
 				 this.axios.get(this.$store.state.api+'xs/info',{
 						 params:{
 							 xxid:logininfo.xxid,
 							 yhid:logininfo.id,
 							 id:this.form.id
 						 }
 					}).then( res =>  {
 							this.form=res.data.data
 					 }).catch(res => {
 						 this.$message.warning("服务器异常");
 			 				this.$emit('close', { type: 'info', cancel: true });
 					 })
 			},
 			 submit() {
 				//检测
 				this.$store.state.loading = true;
 				/*if(!this.form.id) {
 					this.$message.warning('请填写分类');
 					this.$store.state.loading = false;
 					return;
 				}*/
 				//装载数据
 				var logininfo = JSON.parse(localStorage.logininfo);
 				var params2 = qs.stringify({
 						id: this.form.id,
 						dh: this.form.dh,
 						xb: this.form.xb,
 						zwm: this.form.zwm,
 						ywm: this.form.ywm,
 						isty: this.form.isty,
 						iszf: this.form.iszf,
 						isqy: this.form.isqy,
 						csrq: this.form.csrq,
 						zsly: this.form.zsly,
 						fmdh: this.form.fmdh,
 						wx: this.form.wx,
 						jtdz: this.form.jtdz,
 						glxx: this.form.glxx,
 						njbj: this.form.njbj,
 						xh: this.form.xh,
 						yhid: logininfo.id,
 						xxid: logininfo.xxid
 					})
 				//执行
 				    this.axios.post(this.$store.state.api + 'xs/update',  params2 )
 						.then(res => {
 							if(res.data.code == 1) {
 								this.$emit('close', { type: 'edit', cancel: false });
 								this.$store.state.loading = false;
 							} else {
 							this.$message.warning(res.data.msg);
 								this.$store.state.loading = false;
 							}
 						}).catch(res => {
 							this.$message.warning("服务器异常");
 							this.$store.state.loading = false;
 						})
 			},
 			cancel() {
 				this.$emit('close', { type: 'edit', cancel: true })
 			}
 		}
 	}
 </script>
 <style lang="less" scoped>
 .wrap {
   text-align: center;
 }
 .bt{
     position: absolute;
     width: 100%;
     height: 50px;
     margin: 0 auto;
     top: 0;
     left: 0;
     background: #50BFFF;
     color:white;
     text-align:left;
     line-height: 50px;
     font-size: 17px;
     padding-left: 15px;
   }

 .form {
   text-align: left;
   margin-top: 20px;
 }
  .input {
           width: 300px;
           display: inline-block;
       }

 .select-block {
   display: block;
   width: 85%;
 }

 .submit {
   width: 120px;
 }
 </style>
